﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;

namespace IHISCETeim.Web.MachineSys.MacModel
{
    public partial class OMailLineReport : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "OMailLineReport";
            }
        }
        #region 属性 (查询条件)



        protected bool ShowTimeInput
        {
            get
            {
                return GetRequestValue<bool>("ShowTimeInput", true);
            }
        }
        protected string CreateDateFrom
        {
            get
            {
                return  GetRequestValue<string>("CreateDateFrom", "");
            }
        }

        protected string CreateDateTo
        {
            get
            {

                return GetRequestValue<string>("CreateDateTo", "");

            }
        }

        protected int ReportType
        {
            get
            {
                return GetRequestValue<int>("ReportType", 1);
            }
        }

        #endregion
       
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (ReportType)
            {
                case 1:
                    DataBind1();
                    break;
                case 2:
                    DataBind2();
                    break;
            }

            this.AddLog(Permission.查看);
           
        }

        protected DataTable SUMDT1 = new DataTable();
        private void DataBind1()
        {
            DataTableCollection dts=    OMailLineController.OMailLine_GetReport1(CreateDateFrom, CreateDateTo);
            this.rpMenu1.DataSource = dts[0];
            this.rpMenu1.DataBind();

            SUMDT1 = dts[1];
        }

        protected DataTable SUMDT2 = new DataTable();
        private void DataBind2()
        {
            DataTableCollection dts = OMailLineController.OMailLine_GetReport2(CreateDateFrom, CreateDateTo);
            this.rpMenu2.DataSource = dts[0];
            this.rpMenu2.DataBind();

            SUMDT2 = dts[1];
        }

        protected object GetSUMDT1(string FiledName)
        {
            if (SUMDT1.Rows.Count <= 0)
                return 0;
            return SUMDT1.Rows[0][FiledName];
        }

        protected object GetSUMDT2(string FiledName)
        {
            if (SUMDT2.Rows.Count <= 0)
                return 0;
            return SUMDT2.Rows[0][FiledName];
        }

       
    }
}